<?php





namespace app\mini\controller;



// use app\BaseController as BaseController;

use app\mini\model\CustomerCoupon as CustomerCouponModel;

use think\response\Json;





class CustomerCoupon extends Access

{

    /**

     * 所有优惠券列表(展示客户可以领取的优惠券)

     * @return Json

     * @author hz

     * @create 2021-10-22

     */

    public function index(): Json

    {

        $this->param = request()->param();

        $customerCouponModel = new CustomerCouponModel();

        // $this->param['customer_id'] = $this->customerId;

        $data = $customerCouponModel->getDataList($this->param);

        return resultArray($data);

    }



    /**

     * 客户优惠券列表(展示客户已经领取的优惠券)

     * @return Json

     * @author hz

     * @create 2021-10-22

     */

    public function couponList(): Json

    {

        $this->param = request()->param();

        $customerCouponModel = new CustomerCouponModel();

        // $this->param['customer_id'] = $this->customerId;

        $data = $customerCouponModel->getCouponDataList($this->param);

        return resultArray($data);

    }



    /**

     * 查看可用商品

     * @return Json

     * @author hz

     * @create 2021-10-22

     */

    public function goodsList(): Json

    {

        $this->param = request()->param();

        $customerCouponModel = new CustomerCouponModel();

        $this->param['customer_id'] = $this->customerId;

        $data = $customerCouponModel->getGoodsDataList($this->param);

        return resultArray($data);

    }

    /**
     * 员工小程序获取客户优惠券列表
     * @return Json
     * @author yp
     * @create 2022-09-08
     */
    public function staff_getCouponList(): Json
    {
        $this->param = request()->param();

        $customerCouponModel = new CustomerCouponModel();

        $data = $customerCouponModel->getList($this->param);

        return resultArray($data);

    }

    /**
     * 客户小程序获取客户优惠全列表
     * @return Json
     * @author yp
     * @create 2022-11-22
     */
    public function customer_getCoupon(): Json
    {

        $this->param = request()->param();

        $customerCouponModel = new CustomerCouponModel();

        $data = $customerCouponModel->customer_get_coupon($this->param);

        // echo "<pre>";
        // print_r($data);
        // echo "</pre>";
        // exit;

        return resultArray(['error' => '获取成功', 'data' => $data]);

    }

}